/*
 * 蛋白石数据
 */
import * as block_decorating from "./block_decorating";
import * as block_material from "./block_material";
import * as block_mineral from "./block_mineral";
import * as block_energy from "./block_energy";
import * as block_effect from "./block_effect";
import * as block_cable from "./block_cable";
import * as block_gate from "./block_gate";
import * as data_format from "./format";

/**
 * * 类型检测 - 矿石
 */
export const is_mineral = new Set<string>(
    [
        "minecraft:coal_ore",
        "minecraft:iron_ore",
        "minecraft:gold_ore",
        "minecraft:lapis_ore",
        "minecraft:copper_ore",
        "minecraft:quartz_ore",
        "minecraft:diamond_ore",
        "minecraft:emerald_ore",
        "minecraft:redstone_ore",
        "minecraft:ancient_debris",
        "minecraft:raw_iron_block",
        "minecraft:raw_gold_block",
        "minecraft:nether_gold_ore",
        "minecraft:lit_redstone_ore",
        "minecraft:amethyst_cluster",
        "minecraft:raw_copper_block",
        "item_mineral:gold_carbonate",
        "minecraft:deepslate_coal_ore",
        "minecraft:deepslate_iron_ore",
        "minecraft:deepslate_gold_ore",
        "item_mineral:ferric_chloride",
        "minecraft:deepslate_lapis_ore",
        "item_mineral:ferric_phosphate",
        "minecraft:deepslate_copper_ore",
        "item_mineral:zirconium_carbide",
        "item_mineral:lithium_carbonate",
        "minecraft:deepslate_diamond_ore",
        "minecraft:deepslate_emerald_ore",
        "item_mineral:aluminum_magnesium",
        "item_mineral:copper_tin_brazing",
        "minecraft:deepslate_redstone_ore",
        "item_mineral:steel_rock_eutectic",
        "item_mineral:oxygen_enriched_gold",
        "item_mineral:tungsten_copper_alloy",
        "minecraft:lit_deepslate_redstone_ore",
        "item_mineral:tungsten_nickel_titanium"
    ]
);

/**
 * * 类型检测 - 树木
 */
export const is_trees = new Set<string>(
    [
        "minecraft:vine",
        "minecraft:oak_log",
        "minecraft:bee_nest",
        "minecraft:birch_log",
        "minecraft:spruce_log",
        "minecraft:jungle_log",
        "minecraft:acacia_log",
        "minecraft:cherry_log",
        "minecraft:oak_leaves",
        "minecraft:warped_stem",
        "minecraft:shroomlight",
        "minecraft:dark_oak_log",
        "minecraft:mangrove_log",
        "minecraft:crimson_stem",
        "minecraft:birch_leaves",
        "minecraft:chorus_plant",
        "minecraft:spruce_leaves",
        "minecraft:jungle_leaves",
        "minecraft:acacia_leaves",
        "minecraft:cherry_leaves",
        "minecraft:azalea_leaves",
        "minecraft:chorus_flower",
        "minecraft:mangrove_roots",
        "minecraft:dark_oak_leaves",
        "minecraft:mangrove_leaves",
        "minecraft:nether_wart_block",
        "minecraft:warped_wart_block",
        "minecraft:red_mushroom_block",
        "minecraft:brown_mushroom_block",
        "minecraft:azalea_leaves_flowered"
    ]
);

/**
 * * 类型检测 - 不是地面的方块
 */
export const no_ground = new Set<string>(
    [
        "minecraft:air",
        "minecraft:lava",
        "minecraft:vine",
        "minecraft:water",
        "minecraft:oak_log",
        "minecraft:bee_nest",
        "minecraft:birch_log",
        "minecraft:spruce_log",
        "minecraft:jungle_log",
        "minecraft:acacia_log",
        "minecraft:cherry_log",
        "minecraft:oak_leaves",
        "minecraft:warped_stem",
        "minecraft:shroomlight",
        "minecraft:flowing_lava",
        "minecraft:dark_oak_log",
        "minecraft:mangrove_log",
        "minecraft:crimson_stem",
        "minecraft:birch_leaves",
        "minecraft:chorus_plant",
        "minecraft:flowing_water",
        "minecraft:spruce_leaves",
        "minecraft:jungle_leaves",
        "minecraft:acacia_leaves",
        "minecraft:cherry_leaves",
        "minecraft:azalea_leaves",
        "minecraft:chorus_flower",
        "minecraft:mangrove_roots",
        "minecraft:dark_oak_leaves",
        "minecraft:mangrove_leaves",
        "minecraft:nether_wart_block",
        "minecraft:warped_wart_block",
        "minecraft:red_mushroom_block",
        "minecraft:brown_mushroom_block",
        "minecraft:azalea_leaves_flowered"
    ]
);

/**
 * * 类型检测 - 原木
 */
export const is_wood = new Set<string>(
    [
        "minecraft:oak_log",           // 橡木原木
        "minecraft:spruce_log",        // 云杉原木
        "minecraft:birch_log",         // 白桦原木
        "minecraft:jungle_log",        // 从林原木
        "minecraft:acacia_log",        // 金合欢原木
        "minecraft:dark_oak_log",      // 深色橡树原木
        "minecraft:mangrove_log",      // 红杉原木
        "minecraft:cherry_log",        // 樱花原木
        "minecraft:crimson_stem",      // 绯红菌柄
        "minecraft:warped_stem"        // 扭曲菌柄
    ]
);

/**
 * * 类型检测 - 可通行的空间
 */
export const is_space = new Set<string>(
    [
        "minecraft:air",
        "minecraft:lava",
        "minecraft:water",
        "minecraft:wheat",
        "minecraft:reeds",
        "minecraft:poppy",
        "minecraft:allium",
        "minecraft:carrots",
        "minecraft:beetroot",
        "minecraft:potatoes",
        "minecraft:tallgrass",
        "minecraft:red_tulip",
        "minecraft:pink_tulip",
        "minecraft:cornflower",
        "minecraft:melon_stem",
        "minecraft:snow_layer",
        "minecraft:blue_orchid",
        "minecraft:azure_bluet",
        "minecraft:white_tulip",
        "minecraft:oxeye_daisy",
        "minecraft:oak_sapling",
        "minecraft:powder_snow",
        "minecraft:orange_tulip",
        "minecraft:flowing_lava",
        "minecraft:double_plant",
        "minecraft:pumpkin_stem",
        "minecraft:flowing_water",
        "minecraft:yellow_flower",
        "minecraft:birch_sapling",
        "minecraft:structure_void",
        "minecraft:cherry_sapling",
        "minecraft:spruce_sapling",
        "minecraft:jungle_sapling",
        "minecraft:acacia_sapling",
        "minecraft:torchflower_crop",
        "minecraft:sweet_berry_bush",
        "minecraft:dark_oak_sapling",
        "minecraft:lily_of_the_valley",
        "minecraft:mangrove_propagule"
    ]
);

/**
 * 类型检测 - 农产品
 */
export const is_crops = new Map<string, string | boolean>(
    [
        ["minecraft:bamboo", true],
        ["minecraft:pumpkin", true],
        ["minecraft:oak_log", true],
        ["minecraft:birch_log", true],
        ["minecraft:sugar_cane", true],
        ["minecraft:spruce_log", true],
        ["minecraft:jungle_log", true],
        ["minecraft:acacia_log", true],
        ["minecraft:cherry_log", true],
        ["minecraft:melon_block", true],
        ["minecraft:warped_stem", true],
        ["minecraft:chorus_plant", true],
        ["minecraft:dark_oak_log", true],
        ["minecraft:mangrove_log", true],
        ["minecraft:crimson_stem", true],
        ["minecraft:chorus_flower", true],
        ["minecraft:wheat", "test"],
        ["minecraft:cocoa", "test"],
        ["minecraft:carrots", "test"],
        ["minecraft:potatoes", "test"],
        ["minecraft:beetroot", "test"],
        ["minecraft:nether_wart", "test"],
        ["minecraft:oak_sapling", "test"],
        ["minecraft:warped_fungus", "test"],
        ["minecraft:birch_sapling", "test"],
        ["minecraft:crimson_fungus", "test"],
        ["minecraft:bamboo_sapling", "test"],
        ["minecraft:cherry_sapling", "test"],
        ["minecraft:spruce_sapling", "test"],
        ["minecraft:acacia_sapling", "test"],
        ["minecraft:jungle_sapling", "test"],
        ["minecraft:dark_oak_sapling", "test"],
        ["minecraft:sweet_berry_bush", "test"]
    ]
);

/**
 * * 闪长岩桌随机物品粒子列表
 * 
 * @property (typeid, weight)
 * 
 * @param {string} typeid - 粒子的标识符
 * 
 * @param {number} weight - 选择该粒子的权重
 */
export const diorite_table_random_items = new Map<string, number>(
    [
        //* 魔法书籍 系列
        ["constant:outline_of_agriculture_and_forestry", 2],
        ["constant:animal_husbandry_encyclopedia", 2],
        ["constant:source_energy_encyclopedia", 2],
        ["constant:forestry_guidelines", 2],
        ["constant:space_encyclopedia", 2],
        ["constant:mineral_dictionary", 2],
        ["constant:tactical_planning", 2],
        ["constant:faerie_contract", 2],
        ["constant:magic_handbook", 2],
        //* 魔晶工具 系列
        ["constant:magic_crystal_screwdriver", 1],
        ["constant:magic_crystal_marbles", 1],
        ["constant:magic_crystal_wrench", 1],
        ["constant:magic_crystal_shield", 1],
        ["constant:magic_crystal_hammer", 1],
        ["constant:magic_crystal_hoe", 1],
        ["constant:magic_crystal_bow", 1],
        ["constant:magic_crystal_key", 1]
    ]
);

/**
 * * 方块信息 - 月华百科
 */
export const help = new Map<string, data_format.INTENTION_NOTE>(
    [
        //* 家居装饰 系列
        ...block_decorating.help,
        //* 仓储管理 系列
        ...block_material.help,
        //* 矿产勘探 系列
        ...block_mineral.help,
        //* 能源模块 系列
        ...block_energy.help,
        //* 效应机关 系列
        ...block_effect.help,
        //* 魔导总线 系列
        ...block_cable.help,
        //* 机关之门 系列
        ...block_gate.help,
    ]
);
//* 伺服驱动 系列
help.set("block_drive:parameter",
    {
        root: ['伺服驱动', '参数设置', '控制'],
        intel: [
            { text: "使用[§2 魔晶工具 §r]点击, 可以调整<§n 设置参数 §r>\n\n" },
            { text: "在[§5 伺服基座 §r]或[§5 伺服牵引 §r]与之接触时, 同步<§n 设置参数 §r>\n\n" },
            { text: "可作为<§9 限位器 §r>阻止[§5 伺服基座 §r]或[§5 伺服牵引 §r]继续移动\n\n" }
        ]
    }
);
help.set("block_drive:susceptor",
    {
        root: ['伺服驱动', '伺服基座', '驱动'],
        intel: [
            { text: "运行时消耗<§p 星尘力 §r>:§2 30§r\n\n" },
            { text: "使用[§2 魔晶工具 §r]点击, 可以调整<§n 设置参数 §r>\n\n" },
            { text: "下方为<§u 虹彩端口 §r>可与[§3 魔导总线 §r]进行连接\n\n" },
            { text: "当[§3 魔导总线 §r]输入<§9 信号 §r>时, 将携带上方[§d 方块 §r]进行移动\n\n" }
        ]
    }
);
help.set("block_drive:traction",
    {
        root: ['伺服驱动', '伺服牵引', '驱动'],
        intel: [
            { text: "运行时消耗<§p 星尘力 §r>:§2 30§r\n\n" },
            { text: "使用[§2 魔晶工具 §r]点击, 可以调整<§n 设置参数 §r>\n\n" },
            { text: "上方为<§u 虹彩端口 §r>可与[§3 魔导总线 §r]进行连接\n\n" },
            { text: "当[§3 魔导总线 §r]输入<§9 信号 §r>时, 将携带下方[§d 方块 §r]进行移动\n\n" }
        ]
    }
);
help.set("block_drive:omphalos",
    {
        root: ['伺服驱动', '驱动核心', '驱动'],
        intel: [
            { text: "运行时消耗<§p 星尘力 §r>:§2 120§r\n\n" },
            { text: "所有面均为<§u 虹彩端口 §r>可与[§3 魔导总线 §r]进行连接\n\n" },
            { text: "当[§3 魔导总线 §r]输入<§9 信号 §r>时, 将携带周围[§d 结构 §r]进行移动\n\n" },
            { text: "移动时, 将自动检测周围[§d 方块/实体 §r]的<§n 结构尺寸 §r>\n\n" },
            { text: "识别方式为: 检测<§n 射线方向 §r>上最近的[§d 空气 §r]\n\n" },
            { text: "最大结构尺寸为:§2 21 x 21 x 21\n\n" }
        ]
    }
);
//* 魔导武器 系列
help.set("block_weapon:pulse_peak_cannon",
    {
        root: ['魔导武器', '脉冲尖峰'],
        intel: [
            { text: "下方<§u 控制端口 §r>可与[§3 脉冲锁存 §r]进行连接\n\n" },
            { text: "当[§3 脉冲锁存 §r]为<§d 激活状态 §r>时\n\n" },
            { text: "将每秒钟消耗<§p 星尘力 §r>:§2 1§r\n\n" },
            { text: "并在查询到<§c 目标 §r>时, 消耗<§p 星尘力 §r>:§2 150§r\n\n" },
            { text: "对<§c 目标 §r>造成单体<§u 紫雷 §r>伤害\n\n" }
        ]
    }
);
//* 农林工程 系列
help.set("block_plant:planting_and_logging",
    {
        root: ['农林工程', '植树造木'],
        intel: [
            { text: "运行时消耗<§p 星尘力 §r>:§2 50§r\n\n" },
            { text: "北面为<§u 虹彩端口 §r>可与[§3 魔导总线 §r]进行连接\n\n" },
            { text: "南面为<§6 工程端口 §r>负责<§9 伐木 §r>与<§9 植树 §r>\n\n" },
            { text: "当[§3 魔导总线 §r]输入<§9 信号 §r>时, 且[§2 树苗 §r]生长为<§2 树 §r>\n\n" },
            { text: "将种下对应[§2 树苗 §r], 并砍伐树木\n\n" }
        ]
    }
);
help.set("block_plant:crop_detection",
    {
        root: ['农林工程', '作物侦测'],
        intel: [
            { text: "运行时消耗<§p 星尘力 §r>:§2 5§r\n\n" },
            { text: "北面为<§u 虹彩端口 §r>可与[§3 魔导总线 §r]进行连接\n\n" },
            { text: "上方<§u 控制端口 §r>可与[§3 脉冲锁存 §r]进行连接\n\n" },
            { text: "当[§3 脉冲锁存 §r]为<§d 激活状态 §r>时, 南面的<§n 发射端 §r>将周期性的发射<§5 侦测射线 §r>\n\n" },
            { text: "如果<§5 侦测射线 §r>击中<§9 成熟 §r>[§3 作物 §r], 将输出<§9 信号 §r>\n\n" }
        ]
    }
);
//* 曜石熔炼 系列
help.set("block_obsidian:furnace",
    {
        root: ['曜石熔炼', '熔岩', '熔炉'],
        intel: [
            { text: "运行时消耗<§p 星尘力 §r>:§2 45§r\n\n" },
            { text: "当<§6 使用 §r>[§2 压缩圆石 §r]<§6 点击 §r>时, 将填充<§u 待熔炼素材 §r>\n\n" },
            { text: "将在一段时间后将<§u 待熔炼素材 §r>转化为[§c 岩浆 §r]\n\n" },
            { text: "至多存储 8 桶[§c 岩浆 §r]\n\n" },
            { text: "当<§6 使用 §r>[§2 空桶 §r]<§6 点击 §r>时, 将提取[c 岩浆 §r]\n\n" },
            { text: "如果[§c 岩浆 §r]存满, 且附近存在[§3 曜石储罐 §r]\n\n" },
            { text: "将消耗自身[§c 岩浆 §r]储备, 填充附近的[§3 曜石储罐 §r]\n\n" },
            { text: "如果此时下方存在[§3 方块容器 §r], 则会尝试自动拉取[§2 压缩圆石 §r]\n\n" }
        ]
    }
);
help.set("block_obsidian:storage_tank",
    {
        root: ['曜石熔炼', '熔岩', '储罐'],
        intel: [
            { text: "至多存储 16 桶[§2 岩浆 §r]\n\n" },
            { text: "当<§6 使用 §r>[§2 空桶 §r]<§6 点击 §r>时, 将提取[§c 岩浆 §r]\n\n" }
        ]
    }
);